#ifndef FLOAT_HEADER
#define FLOAT_HEADER

// this header needs
#include <stdio.h>
#include <stdlib.h>
#include "BITS.h"
#include "INT.h"
#include "../ARRAY.h"

/************************************
* the functions below are some useful 
* math functions that involve float type
****************************************/

// basic math operations/functions
fmax get_abs(fmax number);
fmax powerof_float_to_sint(fmax base, smax exponent);
fmax get_floor(fmax number);
fmax get_ceil(fmax number);

/********************************************
* function to print bean's default float type
*********************************************/
umax print_fmax_num(void * ptr, umax size);

/*******************************************************************
* the below functions are functions to calculate, from bits, a float
* same description from the INT.h (but for floats) apply to these
*****************************************************************/

// calculate specific float type value from binary
// digits (from bits stored in BIT_HOLDER)
fmax bits_to_ieee754_float(umax bit_holder_pos);

// get specific float type values from memory (size in bits,
// aligned to the leftmost byte from src by l_bit_pos)
fmax calc_mem_ieee754_float(umax byte_cnt, umax lshifts, umax bit_cnt, umax lpad_cnt, void * src, ENDIAN_T endian);

/***************************************************************
* the functions below assume that the bits from floats in memory
* follow the IEEE 754 standard representation and that the system
* uses the same standard as well for floats (also that CHAR_BIT
* is 8, that the floats are byte aligned, and that fmax is 
* an actually double precision float)
*************************************/

// convert a float type to another one (conversion
// to and from 16, 32 and 64 bit representations)
bool convert_float(umax src_bits_cnt, void * src, ENDIAN_T src_endian,
                   umax dest_bit_cnt, void * dest, ENDIAN_T dest_endian);

// get specific float type from memory an return its value
fmax get_float(umax bits_cnt, void * src, ENDIAN_T endian);

// print std floats
umax print_float16be(void * ptr, umax size);
umax print_float16le(void * ptr, umax size);
umax print_float32be(void * ptr, umax size);
umax print_float32le(void * ptr, umax size);
umax print_float64be(void * ptr, umax size);
umax print_float64le(void * ptr, umax size);

#include "FLOAT.c"

#endif // FLOAT_HEADER
